updating type hint for solutions#9
Conversation
|
Quick note, can you add common virtual environment names to the |
|
The |
|
I pointed out a few, but type hints are missing for many of the variables and nearly all of the parameters in the parameter list. |
| g = 9.8 # velocity | ||
|
|
||
| return 0.5 * g * t*t | ||
| def fall_distance(t) -> float: |
There was a problem hiding this comment.
missing type hint on parameter t
There was a problem hiding this comment.
still missing type hint on parameter t
| curr_num = 1 | ||
| sol = 1 | ||
| for i in range(n-1): | ||
| def fib(n) -> int: |
There was a problem hiding this comment.
missing type hint on parameter n
There was a problem hiding this comment.
still missing type hint on parameter n
| Represents a taxicab that tracks the distance traveled when given x and y coordinates | ||
| """ | ||
| def __init__(self, x, y): | ||
| def __init__(self, x, y) -> None: |
There was a problem hiding this comment.
missing type hint on x and y parameters
branhoff
left a comment
There was a problem hiding this comment.
You may want to use mypy: https://www.mypy-lang.org/ to check that your type hinting is correct.
| # Description: Mutates a given list and by the order of the elements of teh list | ||
|
|
||
| def reverse_list(lst): | ||
| def reverse_list(lst: any) -> None: |
There was a problem hiding this comment.
I don't believe any is a type hint. The recommendation I ready is to call object for the Any class. This should be type hinted as list[object]
| # Description: Mutates a given list and by the order of the elements of teh list | ||
|
|
||
| def reverse_list(lst): | ||
| def reverse_list(lst: object) -> None: |
There was a problem hiding this comment.
this is type hinting a parameter named lst of any type. I think you mean lst: list[object]
| """ | ||
| temp_lst = [] | ||
| for i in range(len(lst)-1,-1, -1): | ||
| temp_lst: object = [] |
There was a problem hiding this comment.
Same here. This should be temp_list: list[object] = []
@branhoff review please